package com.massteam.service.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Service;

import com.massteam.dao.BaseDAO;
import com.massteam.pojo.User;
import com.massteam.service.UserService;
@Service("userService")
public class UserServiceImpl implements UserService{
	@Autowired
	@Qualifier("baseDao")
	BaseDAO baseDao;
	
	public void addUser(User user) {
		baseDao.saveOrUpdate(user);
	}

	public void delUser(int id) {
		baseDao.delById(User.class, id);
	}

	@SuppressWarnings("unchecked")
	public List<User> queryUser(String hql) {
		List<User> list = null;
		
		list = (List<User>) baseDao.query(hql);
		
		return list;
	}

	public void updateUser(String hql) {
		baseDao.update(hql);
	}

	public User findUserById(String id) {
		return (User) baseDao.loadById(User.class, id);
	}

}
